﻿using System;
using System.Text;

namespace GPS.GPSLanguage
{
    public enum StatusType { Active, Void , Unknown};
    class StatusToken
    {
        public static String[] StatusText = { "Active", "Void", "Unknown" };
        internal static void ParseLanguage(GPSData gpsData, System.Collections.Queue q)
        {
            String token = (string)q.Dequeue();

            switch (token)
            {
                case "A":
                    gpsData.SetRMCStatus(StatusType.Active);
                    break;
                case "V":
                    gpsData.SetRMCStatus(StatusType.Void);
                    break;
                default:
                    gpsData.SetRMCStatus(StatusType.Unknown);
                    break;
            }

            switch (gpsData.MessageType)
            {
                case MessageType.GPRMC:
                    LatitudeToken.ParseLanguage(gpsData, q);
                    break;
                case MessageType.GPGLL:
                    gpsData.SetGPSSentenceComplete();
                    break;
                default:
                    throw new InvalidLanguageException("How did you get here?");
            }
        }
    }
}
